package com.raylu.gmallbigscreen.mapper;

import com.raylu.gmallbigscreen.beans.ProductStats;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 * Description:
 * <p>
 * Create by lucienoz on 2022/1/10.
 * Copyright © 2022 lucienoz. All rights reserved.
 */
public interface ProductStatsMapper {

    @Select("select sum(order_amount) from dws_product_stats where toYYYYMMDD(stt)=#{date}")
    BigDecimal selectGmv(Integer date);

    @Select("select tm_name,sum(order_amount)/10000 order_amount,sum(order_cnt) order_cnt from dws_product_stats where toYYYYMMDD(stt)=#{date} group by tm_name limit #{limit}")
    List<ProductStats> selectProductStatsByTm(@Param("date") Integer date,@Param("limit") Integer limit);

}
